<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreateProductsTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateProductsLabel_id}" for="id" />
                    <h:inputText id="id" value="#{productsController.selected.id}" title="#{bundle.CreateProductsTitle_id}" required="true" requiredMessage="#{bundle.CreateProductsRequiredMessage_id}"/>
                    <h:outputLabel value="#{bundle.CreateProductsLabel_name}" for="name" />
                    <h:inputText id="name" value="#{productsController.selected.name}" title="#{bundle.CreateProductsTitle_name}" />
                    <h:outputLabel value="#{bundle.CreateProductsLabel_star}" for="star" />
                    <h:inputText id="star" value="#{productsController.selected.star}" title="#{bundle.CreateProductsTitle_star}" />
                    <h:outputLabel value="#{bundle.CreateProductsLabel_description}" for="description" />
                    <h:inputText id="description" value="#{productsController.selected.description}" title="#{bundle.CreateProductsTitle_description}" />
                    <h:outputLabel value="#{bundle.CreateProductsLabel_price}" for="price" />
                    <h:inputText id="price" value="#{productsController.selected.price}" title="#{bundle.CreateProductsTitle_price}" required="true" requiredMessage="#{bundle.CreateProductsRequiredMessage_price}"/>
                    <h:outputLabel value="#{bundle.CreateProductsLabel_image}" for="image" />
                    <h:inputText id="image" value="#{productsController.selected.image}" title="#{bundle.CreateProductsTitle_image}" />
                    <h:outputLabel value="#{bundle.CreateProductsLabel_isbn}" for="isbn" />
                    <h:inputText id="isbn" value="#{productsController.selected.isbn}" title="#{bundle.CreateProductsTitle_isbn}" />
                    <h:outputLabel value="#{bundle.CreateProductsLabel_categoryID}" for="categoryID" />
                    <h:selectOneMenu id="categoryID" value="#{productsController.selected.categoryID}" title="#{bundle.CreateProductsTitle_categoryID}" required="true" requiredMessage="#{bundle.CreateProductsRequiredMessage_categoryID}">
                        <f:selectItems value="#{categoryController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <br />
                <h:commandLink action="#{productsController.create}" value="#{bundle.CreateProductsSaveLink}" />
                <br />
                <br />
                <h:commandLink action="#{productsController.prepareList}" value="#{bundle.CreateProductsShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:link outcome="/index" value="#{bundle.CreateProductsIndexLink}"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
